package tech.xs.auth.controller;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import tech.xs.auth.domain.exception.AuthException;
import tech.xs.auth.service.AuthPathService;
import tech.xs.common.framework.domain.model.ApiResult;

import javax.annotation.Resource;


@Slf4j
@Validated
@RestController
@RequestMapping("/path")
public class AuhPathController {

    @Resource
    private AuthPathService pathService;


    @GetMapping("/isPathAuthBasic")
    public ApiResult<Boolean> isPathAuthBasic(@RequestParam String path, @RequestParam String method) {
        if (StrUtil.isBlank(path)) {
            throw new AuthException("path 不能为空");
        }
        return pathService.isPathAuthBasic(path, method);
    }

}
